package com.smile.f315;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;

import javax.swing.JFrame;
import javax.swing.JPanel;
class RectanglePanel extends JPanel{
	public void paintComponent(Graphics g){
		super.paintComponents(g);
		Graphics2D g2 = (Graphics2D)g;
		RoundRectangle2D rect = new RoundRectangle2D.Double(20.0, 10.0, 200.0, 60.0, 10, 10);
		g2.draw(rect);
	}
}
public class RectangleDemo {
	public void createUI(){
		JFrame frame = new JFrame("绘制矩形示例程序");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		RectanglePanel panel = new RectanglePanel();
		frame.add(panel);
		
		frame.setBounds(200, 200, 250, 120);
		frame.setVisible(true);
	}
	public static void main(String[] args) {
		RectangleDemo example = new RectangleDemo();
		example.createUI();
	}
}